package com.yunji.common.enums.common;

import com.yunji.common.utils.bean.BeanUtils;

import java.util.Objects;

public enum TextRecordType {

    OTHER(0, "其他"),
    PRIVACY(1, "邮箱"),
    POLICY(2,"政策")        ;

    private final Integer code;
    private final String text;

    TextRecordType(Integer code, String text) {
        this.code = code;
        this.text = text;
    }

    public Integer getCode() {
        return code;
    }

    public String getText() {
        return text;
    }

    public static String get(Integer code) {
        if (BeanUtils.isNull(code)) {
            return null;
        }
        TextRecordType[] enums = TextRecordType.values();
        for (TextRecordType e : enums) {
            if (Objects.equals(e.code, code)) {
                return e.text;
            }
        }
        return null;
    }
}
